#ifndef OALGO_H
#define OALGO_H

#include "Vertex.h"

namespace Y{

Vertex3f cross (const Vertex3f& one,const Vertex3f& two){
	Vertex3f vex;
	for (int i = 0; i < 3; i++){
		vex.data(i) = one.data((i + 1) % 3) * two.data((i + 2) % 3) - one.data((i + 2) % 3) * two.data((i + 1) % 3);
	}
	return vex;
}

float dot (const Vertex3f& one, const Vertex3f& two){
	return (one.data(0) * two.data(0) + one.data(1) * two.data(1) + one.data(2) * two.data(2));
}

float to_zero ( float f, float d ){ if ( f == 0 ){ return 0.0; } else if ( f > 0 ) { return std::max(0.0f,f - d); } return std::min(0.0f,f + d); }

}
#endif